// 处理剪贴板操作
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
    if (request.action === "copyToClipboard") {
        navigator.clipboard.writeText(request.text).then(() => {
            sendResponse({success: true});
        }).catch(err => {
            sendResponse({success: false, error: err});
        });
        return true; // 保持消息通道开放
    }
});